package cn.wolfcode.car.business.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

/**
 * 服务单项
 */
@Setter
@Getter
@TableName("bus_service_item")
public class ServiceItem {
    private static final long serialVersionUID = 1L;
    public static final Integer CARPACKAGE_NO = 0;//不是套餐
    public static final Integer CARPACKAGE_YES = 1;//是套餐
    public static final Integer AUDITSTATUS_INIT = 0;//初始化
    public static final Integer AUDITSTATUS_AUDITING = 1;//审核中
    public static final Integer AUDITSTATUS_APPROVED = 2;//审核通过
    public static final Integer AUDITSTATUS_REPLY = 3;//重新调整
    public static final Integer AUDITSTATUS_NO_REQUIRED = 4;//无需审核
    public static final Integer SALESTATUS_OFF = 0;//下架
    public static final Integer SALESTATUS_ON = 1;//上架
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    @TableField(value = "name")
    private String name;                //服务项名称
    @TableField(value = "original_price")
    private BigDecimal originalPrice;    //服务项原价
    @TableField(value = "discount_price")
    private BigDecimal discountPrice;    //服务项折扣价
    @TableField(value = "car_package")
    private Integer carPackage;          //是否套餐【是/否】
    @TableField(value = "info")
    private String info;                 //备注信息
    @TableField(value = "create_time")
    private Date createTime;             //创建时间
    @TableField(value = "service_catalog")
    private Integer serviceCatalog;      //服务分类【维修/保养/其他】
    @TableField(value = "audit_status")
    private Integer auditStatus = AUDITSTATUS_NO_REQUIRED;       //审核状态【初始化/审核中/审核通过/审核拒绝/无需审核】
    @TableField(value = "sale_status")
    private Integer saleStatus = SALESTATUS_OFF;                 //上架状态【已上架/未上架】

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServiceItem that = (ServiceItem) o;
        return Objects.equals(name, that.name) &&
                Objects.equals(originalPrice, that.originalPrice) &&
                Objects.equals(discountPrice, that.discountPrice) &&
                Objects.equals(carPackage, that.carPackage) &&
                Objects.equals(info, that.info) &&
                Objects.equals(serviceCatalog, that.serviceCatalog);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, originalPrice, discountPrice, carPackage, info, serviceCatalog);
    }
}